package com.qxp.simplerpc;


import com.qxp.simplerpc.annotation.EnableSimpleRpcAutoConfig;
import com.qxp.simplerpc.utils.RedisUtils;
import com.qxp.simplerpc.utils.SimpleRpcProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConditionalOnBean(annotation= EnableSimpleRpcAutoConfig.class)
@AutoConfigureAfter(AutoConfiguration.class)
public class CommonAutoConfiguration {
    @Autowired
    private SimpleRpcProperties simpleRpcProperties;

    public SimpleRpcProperties getSimpleRpcProperties() {
        return simpleRpcProperties;
    }

    public void setSimpleRpcProperties(SimpleRpcProperties simpleRpcProperties) {
        this.simpleRpcProperties = simpleRpcProperties;
    }

    @Bean
    public RedisUtils getRedisUtils(){
        return new RedisUtils();
    }

}
